package bishihuizong;
import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by JiaJia on 2019/9/22 0022.
 */
public class Vivo01 {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String inputStr = br.readLine();
        int input[] = parseInts(inputStr.split(" "));
        String output = solution(input);
        System.out.println(output);
    }

    private static int[] parseInts(String[] strArr) {
        if (strArr == null || strArr.length == 0) {
            return new int[0];
        }
        int[] intArr = new int[strArr.length];
        for (int i = 0; i < intArr.length; i++) {
            intArr[i] = Integer.parseInt(strArr[i]);
        }
        return intArr;
    }

    private static String solution(int[] input) {
        int n=input[0];
        int m=input[1];
        List<Integer> list=new ArrayList<>();
        List<Integer> result=new ArrayList<>();
        for (int i = 1; i <=n ; i++) {
            list.add(i);
        }
        int k=0;
        while (list.size()>0){
            k=k+m;
            k=k%(list.size())-1;
            if (k<0){
                result.add(list.get(list.size()-1));
                list.remove(list.size()-1);
                k=0;
            }else {
                result.add(list.get(k));
                list.remove(k);
            }
        }
        StringBuilder sb=new StringBuilder();
        for (int num:result){
            sb.append(num).append(" ");
        }
        return sb.toString();
    }
}